//
//  CSAnimationViewController.m
//  CSUIKit
//
//  Created by 网新中研 on 16/8/23.
//  Copyright © 2016年 centralsoft. All rights reserved.
//

#import "CSAnimationViewController.h"

@interface CSAnimationViewController ()<UIScrollViewDelegate>
@property (strong, nonatomic) IBOutlet UIView *barView;
@property (strong, nonatomic) IBOutlet UIScrollView *scrollView;

@end

@implementation CSAnimationViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    self.scrollView.delegate = self;
    
    self.scrollView.contentSize = CGSizeMake(0, 1000);
    
}

-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
    NSLog(@"x:%f; y:%f", scrollView.contentOffset.x, scrollView.contentOffset.y); ;
    
    CGFloat opacity = (self.barView.frame.size.height - scrollView.contentOffset.y/3.0) / self.barView.frame.size.height;
    
    self.barView.layer.opacity =  opacity < 0 ? 0 : opacity;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
